package unitTests;

import java.io.File;
import java.util.ArrayList;

import parser.Parser;
import parser.ParserError;
import scanner.Scanner;
import ast.ASTTree;


public class EvaluatorTest {
	public static void main(String[] args) throws Exception
	{
		Scanner s = new Scanner(new File("tests/testScript5.mawk"));
		
		Parser p = new Parser(s);
		ASTTree ast = p.getASTTree();
		System.out.println(ast);
		ArrayList<ParserError> pe = p.getErrorList();
		for(int i = 0; i < pe.size(); i++)
			System.err.println(pe.get(i).toString());
		
		if(!pe.isEmpty())
		{
			ast.run(new File("tests/testInput1.data"));
			System.out.println("\n" + ast.getOutput());
		}
	}
}